package com.cuijq.ms.statedesign.v5.impl;

import com.cuijq.ms.statedesign.v5.MarioStateMachine;
import com.cuijq.ms.statedesign.v5.State;
import com.cuijq.ms.statedesign.v5.IMario;

/**
 * @author by CuiJQ
 * @Classname SuperMario
 * @Description SuperMario Description
 * @Date 2021/5/29 16:15
 */
public class SuperMario implements IMario {

  private static final SuperMario instance = new SuperMario();

  private SuperMario() {
  }

  public static SuperMario getInstance() {
    return instance;
  }

  @Override
  public State getName() {
    return State.SUPER;
  }

  @Override
  public void obtainMushRoom(MarioStateMachine stateMachine) {

  }

  @Override
  public void obtainCape(MarioStateMachine stateMachine) {
    stateMachine.setCurrentState(CapeMario.getInstance());
    stateMachine.setScore(stateMachine.getScore() + 200);
  }

  @Override
  public void obtainFireFlower(MarioStateMachine stateMachine) {
    stateMachine.setCurrentState(FireMario.getInstance());
    stateMachine.setScore(stateMachine.getScore() + 300);
  }

  @Override
  public void meetMonster(MarioStateMachine stateMachine) {
    stateMachine.setCurrentState(SmallMario.getInstance());
    stateMachine.setScore(stateMachine.getScore() - 100);
  }

}
